<?php
namespace app\common\model;

class Option extends Base
{
    protected $table = 'option_items';

    public function option_value()
    {
        return $this->hasMany(OptionValue::class, 'item_id', 'id');
    }

    public function getOptionValueCountAttr($value, $data)
    {
        $count = OptionValue::where('item_id', $data['id'])->count();

        return $count;
    }
}